<?php

/**
 * @author Martin Pernica
 * @copyright 2008
 */

 echo '<br /><h2><a href="index.php?p=components&name=sections">'.Lang::getBackGlobal('back').'</a></h2><br />';
 if(!empty($_POST['name'])){
    
    $name = Registry::get('db')->real_escape_string( $_POST['name'] );
    $description = Registry::get('db')->real_escape_string( $_POST['description'] );
    
    $query = Registry::get('db')->query("UPDATE {prefix}sections SET name = '".$name."', description = '".$description."' WHERE id = '".intval($_GET['id'])."'");
	$log->write(8, 'com_sections', 'NOW()', 'User edited section #' . intval($_GET['id']), $_SESSION['id']);
    
    messageBox( Lang::getBack('com_sections', 'section_edited') );
 }
$data = Registry::get('db')->query("SELECT * FROM {prefix}sections WHERE id = '".intval($_GET['id'])."' LIMIT 1");
$data = $data->fetch_array();

$form = new Form;
$form->addTextbox('name', Lang::getBack('com_sections', 'name'), stripslashes($data['name']) );
$form->addTextbox('description', Lang::getBack('com_sections', 'description'), stripslashes($data['description']) );
$form->addSubmit('submit', Lang::getBackGlobal('submit'));

echo $form;

?>